/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.jcdev.coolrss.view;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import thinlet.swing.app.AppFrame;
import thinlet.swing.border.LineBorder;
import thinlet.swing.container.MenuList;
import thinlet.swing.container.SplitPane;
import thinlet.swing.container.ToolFooter;

/**
 *
 * @author carlos
 */
public class Index extends AppFrame {

    private SplitPane splitPane;
    private JPanel leftPanel;
    private ToolFooter toolPanel;
    private JPanel content;

    public Index() {
        super();
        initComponents();
    }

    /**
     * Set window left panel
     * @param leftPanel The left panel
     */
    public void setLeftPanel(JPanel leftPanel) {
        this.leftPanel = leftPanel;
    }

    /**
     * Get current left panel
     * @return The left panel
     */
    public JPanel getLeftPanel() {
        return this.leftPanel;
    }

    /**
     * Get content panel
     * @return The content panel
     */
    public JPanel getContent() {
        return content;
    }

    /**
     * Set the content panel
     * @param content The content panel
     */
    public void setContent(JPanel content) {
        this.content = content;
    }

    /**
     * Add new button to the tool panel
     * @param icon The button icon
     * @param toolTip The button tooltip
     * @param actionListener The button action
     */
    public void addToolPanelButton(Icon icon, String toolTip, ActionListener actionListener) {
        this.toolPanel.addButton(icon, toolTip, actionListener);
    }

    /**
     * Add new plus button to the tool panel
     * @param toolTip The button tooltip
     * @param actionListener The button action
     */
    public void addToolPanelPlusButton(String toolTip, ActionListener actionListener) {
        this.toolPanel.addPlusButton(toolTip, actionListener);
    }

    /**
     * Add new minus button to the tool panel
     * @param toolTip The button tooltip
     * @param actionListener The button action
     */
    public void addToolPanelMinusButton(String toolTip, ActionListener actionListener) {
        this.toolPanel.addMinusButton(toolTip, actionListener);
    }

    @Override
    protected void init() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    protected boolean close() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    /**
     * Initialize GUI components
     */
    private void initComponents() {
        this.leftPanel = new JPanel();
        this.content = new JPanel();
        this.splitPane = new SplitPane(leftPanel, content, JSplitPane.HORIZONTAL_SPLIT);
        this.toolPanel = new ToolFooter();
        this.toolPanel.add(Box.createHorizontalGlue());
        this.toolPanel.setBorder(new LineBorder(new Color(0xaaaaaa), 1, 0, 0, 0));
        this.toolPanel.add(splitPane.getKnob());
        this.add(splitPane, BorderLayout.CENTER);

        this.setSize(500, 400);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}
